package Controller;
import java.util.ArrayList;

import Client.MyRemoteClient;
import PO.DiscountslistPO;
import PO.ExchangecouponslistPO;
import PO.GoodsconversionsListPO;
import Promotion.*;
import VO.*;
import remote.*;
public class writePromotion {
	
	public static void main (String[] args){
		GoodsconversionsListVO conlistVO;
		GoodsconversionsListPO conlistPO;
		GoodsconversionsList conlist; 
		
		ExchangecouponsListVO exchlistVO;
		ExchangecouponslistPO exchlistPO;
		ExchangecouponsList exchlist;
		
		DiscountsListVO dislistVO;
		DiscountslistPO dislistPO;
		DiscountsList dislist; 
		String gcinfo[][]={{"1","20","1"},{"2","50","3"},{"3","100","10"}};
     	String exinfo[][]={{"1","50","5"},{"2","100","15"},{"3","200","50"}};
     	String disinfo[][]={{"1","1","0.11"},{"2","2","0.22"},{"3","3","0.33"}};
		ArrayList<GoodsconversionsVO> gcl=new ArrayList<GoodsconversionsVO>();
		ArrayList<Goodsconversions> gclist=new ArrayList<Goodsconversions>();
		GoodsconversionsVO gcvo1=new GoodsconversionsVO(gcinfo[0]); Goodsconversions gc1=new Goodsconversions(gcvo1);
		GoodsconversionsVO gcvo2=new GoodsconversionsVO(gcinfo[1]); Goodsconversions gc2=new Goodsconversions(gcvo2);
		GoodsconversionsVO gcvo3=new GoodsconversionsVO(gcinfo[2]); Goodsconversions gc3=new Goodsconversions(gcvo3);
		gcl.add(gcvo1); 
		gcl.add(gcvo2);
		gcl.add(gcvo3);
		
		gclist.add(gc1); 
		gclist.add(gc2);
		gclist.add(gc3);
		conlistVO=new GoodsconversionsListVO(gcl);
		conlist=new GoodsconversionsList(gclist);
		conlistPO=new GoodsconversionsListPO(conlist);

		ArrayList<ExchangecouponsVO> exl=new ArrayList<ExchangecouponsVO>();
		ArrayList<Exchangecoupons> exlist=new ArrayList<Exchangecoupons>();
		ExchangecouponsVO exvo1=new ExchangecouponsVO(exinfo[0]); Exchangecoupons ex1=new Exchangecoupons(exvo1);
		ExchangecouponsVO exvo2=new ExchangecouponsVO(exinfo[1]); Exchangecoupons ex2=new Exchangecoupons(exvo2);
		ExchangecouponsVO exvo3=new ExchangecouponsVO(exinfo[2]); Exchangecoupons ex3=new Exchangecoupons(exvo3);
		exl.add(exvo1); 
		exl.add(exvo2);
		exl.add(exvo3);
		
		exlist.add(ex1); 
		exlist.add(ex2);
		exlist.add(ex3);
		exchlistVO=new ExchangecouponsListVO(exl);
		exchlist=new ExchangecouponsList(exlist);
		exchlistPO=new ExchangecouponslistPO(exchlist);

		
		ArrayList<DiscountsVO> dl=new ArrayList<DiscountsVO>();
		ArrayList<Discounts> dlist=new ArrayList<Discounts>();
		DiscountsVO dvo1=new DiscountsVO(disinfo[0]); Discounts d1=new Discounts(dvo1);
		DiscountsVO dvo2=new DiscountsVO(disinfo[1]); Discounts d2=new Discounts(dvo2);
		DiscountsVO dvo3=new DiscountsVO(disinfo[2]); Discounts d3=new Discounts(dvo3);
		dl.add(dvo1); 
		dl.add(dvo2);
		dl.add(dvo3);
		
		dlist.add(d1); 
		dlist.add(d2);
		dlist.add(d3);
		dislistVO=new DiscountsListVO(dl);
		dislist=new DiscountsList(dlist);
		dislistPO=new DiscountslistPO(dislist);

	
	
	try{
		MyRemoteClient.getDataService().update(conlistPO);
	}catch(Exception ex){
		ex.printStackTrace();
	}
	try{
		MyRemoteClient.getDataService().update(exchlistPO);
	}catch(Exception ex){
		ex.printStackTrace();
	}
	try{
		MyRemoteClient.getDataService().update(dislistPO);
	}catch(Exception ex){
		ex.printStackTrace();
	}
}
}
